package com.ruoyi.project.im.welcome.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.im.welcome.mapper.WelcomeMapper;
import com.ruoyi.project.im.welcome.domain.Welcome;
import com.ruoyi.project.im.welcome.service.IWelcomeService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 消息Service业务层处理
 *
 * @author ruoyi
 * @date 2022-09-11
 */
@Service
public class WelcomeServiceImpl implements IWelcomeService
{
    @Autowired
    private WelcomeMapper welcomeMapper;

    /**
     * 查询消息
     *
     * @param userId 消息主键
     * @return 消息
     */
    @Override
    public Welcome selectWelcomeByUserId(String userId)
    {
        return welcomeMapper.selectWelcomeByUserId(userId);
    }

    /**
     * 查询消息列表
     *
     * @param welcome 消息
     * @return 消息
     */
    @Override
    public List<Welcome> selectWelcomeList(Welcome welcome)
    {
        return welcomeMapper.selectWelcomeList(welcome);
    }

    /**
     * 新增消息
     *
     * @param welcome 消息
     * @return 结果
     */
    @Override
    public int insertWelcome(Welcome welcome)
    {
        welcome.setCreateTime(DateUtils.getNowDate());
        return welcomeMapper.insertWelcome(welcome);
    }

    /**
     * 修改消息
     *
     * @param welcome 消息
     * @return 结果
     */
    @Override
    public int updateWelcome(Welcome welcome)
    {
        return welcomeMapper.updateWelcome(welcome);
    }

    @Override
    public int updateWelcomeById(Welcome id){
        return welcomeMapper.updateWelcomeById(id);
    }

    /**
     * 批量删除消息
     *
     * @param userIds 需要删除的消息主键
     * @return 结果
     */
    @Override
    public int deleteWelcomeByUserIds(String userIds)
    {
        return welcomeMapper.deleteWelcomeByUserIds(Convert.toStrArray(userIds));
    }

    @Override
    public int deleteWelcomeById(Integer id)
    {
        return welcomeMapper.deleteWelcomeById(id);
    }


    /**
     * 删除消息信息
     *
     * @param userId 消息主键
     * @return 结果
     */
    @Override
    public int deleteWelcomeByUserId(String userId)
    {
        return welcomeMapper.deleteWelcomeByUserId(userId);
    }
}
